package learn.facade;

/**
 * 外观模式
 *
 * @author 执笔
 * @date 2019/12/26 16:45
 */
public class Facade {

    /**
     * 读取文件
     */
    class ReadFile {
        public String read(String fileName) {
            return "";
        }
    }

    /**
     * 加密文件
     */
    class EncryptFile {
        public String encrypt(String content) {
            return "";
        }
    }

    /**
     * 保存文件
     */
    class SaveFile {
        public void save(String fileName, String content) {
        }

    }

    /**
     * 外观模式
     */
    class FacadeSample {
        private ReadFile readFile;
        private EncryptFile encryptFile;
        private SaveFile saveFile;

        public FacadeSample() {
            readFile = new ReadFile();
            encryptFile = new EncryptFile();
            saveFile = new SaveFile();
        }

        public void exec(String fileName, String saveName) {
            String content = readFile.read(fileName);
            String encrypt = encryptFile.encrypt(content);
            saveFile.save(saveName, content);
        }
    }


}
